/*
 * @Author: TT-hzy 
 * @Date: 2024-06-25 16:52:02
 * @LastEditors: TT-hzy 
 * @LastEditTime: 2024-06-25 16:57:12
 * @Description: 
 */


import { EggAppConfig, PowerPartial } from 'egg';



export type DefaultConfig = PowerPartial<EggAppConfig & BizConfig>;


export interface BizConfig {
  sourceUrl: string;
  news: {
    pageSize: number;
    serverUrl: string;
  }
}

export default (appInfo: EggAppConfig) => {
  const config = {} as PowerPartial<EggAppConfig> & BizConfig;

  config.news = {
    pageSize: 30,
    serverUrl: 'https://api.tuchong.com/feed-app',
  }

  config.keys = appInfo.name + '123456';
  config.view = {
    defaultViewEngine: 'nunjucks',


  };

  config.cors = {
    origin: '*',
    allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'
  }



  return config;
};